package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.Livebroadcastingroom;
import com.ruoyi.system.mapper.LivebroadcastingroomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StudioAttentionMapper;
import com.ruoyi.system.domain.StudioAttention;
import com.ruoyi.system.service.IStudioAttentionService;

/**
 * 直播间关注Service业务层处理
 * 
 * @author kinglu
 * @date 2021-11-30
 */
@Service
public class StudioAttentionServiceImpl implements IStudioAttentionService 
{
    @Autowired
    private StudioAttentionMapper studioAttentionMapper;
    @Autowired
    private LivebroadcastingroomMapper livebroadcastingroomMapper;
    /**
     * 查询直播间关注
     * 
     * @param id 直播间关注主键
     * @return 直播间关注
     */
    @Override
    public StudioAttention selectStudioAttentionById(Long id)
    {
        return studioAttentionMapper.selectStudioAttentionById(id);
    }

    /**
     * 查询直播间关注列表
     * 
     * @param studioAttention 直播间关注
     * @return 直播间关注
     */
    @Override
    public List<StudioAttention> selectStudioAttentionList(StudioAttention studioAttention)
    {
        return studioAttentionMapper.selectStudioAttentionList(studioAttention);
    }

    /**
     * 新增直播间关注
     * 
     * @param studioAttention 直播间关注
     * @return 结果
     */
    @Override
    public int insertStudioAttention(StudioAttention studioAttention)
    {
        return studioAttentionMapper.insertStudioAttention(studioAttention);
    }

    /**
     * 修改直播间关注
     * 
     * @param studioAttention 直播间关注
     * @return 结果
     */
    @Override
    public int updateStudioAttention(StudioAttention studioAttention)
    {
        return studioAttentionMapper.updateStudioAttention(studioAttention);
    }

    /**
     * 批量删除直播间关注
     * 
     * @param ids 需要删除的直播间关注主键
     * @return 结果
     */
    @Override
    public int deleteStudioAttentionByIds(Long[] ids)
    {
        return studioAttentionMapper.deleteStudioAttentionByIds(ids);
    }

    /**
     * 删除直播间关注信息
     * 
     * @param id 直播间关注主键
     * @return 结果
     */
    @Override
    public int deleteStudioAttentionById(Long id)
    {
        return studioAttentionMapper.deleteStudioAttentionById(id);
    }

    /**
     * 获取直播间id
     *
     */
    @Override
    public Livebroadcastingroom getstudioid(String userid)
    {
       StudioAttention studioAttention =  studioAttentionMapper.getstudioid(userid);
       String studioid = String.valueOf(studioAttention.getStudioId());
       Livebroadcastingroom livebroadcastingroom = livebroadcastingroomMapper.selectLivebroadcastingroomByRoomId(Long.valueOf(studioid));
        return livebroadcastingroom;
    };
}
